import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import com.bigmodel.contant.intelligentWorkOrder.Punctuation;
import com.bigmodel.contant.intelligentWorkOrder.identityCard.IdentityCardNoun;
import com.bigmodel.contant.intelligentWorkOrder.name.Verb;
import com.bigmodel.contant.intelligentWorkOrder.phone.Phone;
import com.bigmodel.entity.QAEntity;
import com.bigmodel.entity.SoltEntity;
import com.bigmodel.entity.TimeEntity;
import com.bigmodel.util.ExcelUtil;
import com.bigmodel.util.FtlUtil;
import com.bigmodel.util.TimeUtils;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.stream.Collectors;

public class IntelligentWorkOrder_V1 {

    private final static String OUT_PATH = "E:\\bld\\大模型\\语料\\长沙银行\\intelligentWorkOrder_v1\\";

    private final static String FREEMARKER_BASE_PATH = "sft/intelligentWorkOrder_v1/";

    /**
     * 标点符号
     */
    private static List<String> LIST_PUNCTUATION = null;
    /**
     * 姓名-动词-1
     */
    private static List<String> LIST_VERB_ONE = null;
    /**
     * 姓名-动词-2
     */
    private static List<String> LIST_VERB_TWO = null;
    /**
     * 身份证-名词
     */
    private static List<String> LIST_IDENTITY_CARD_NOUN = null;
    /**
     * 身份证-动词
     */
    private static List<String> LIST_IDENTITY_CARD_VERB = null;

    /**
     * 手机号-名词
     */
    private static List<String> LIST_PHONE_NOUN = null;
    /**
     * 手机号-动词
     */
    private static List<String> LIST_PHONE_VERB = null;

    static {
        LIST_PUNCTUATION = ListUtil.toList(Punctuation.LIST_PUNCTUATION);
        LIST_VERB_ONE = ListUtil.toList(Verb.LIST_VERB_ONE);
        LIST_IDENTITY_CARD_NOUN = ListUtil.toList(IdentityCardNoun.LIST_IDENTITY_CARD_NOUN);
        LIST_IDENTITY_CARD_VERB = ListUtil.toList(IdentityCardNoun.LIST_IDENTITY_CARD_VERB);
        LIST_PHONE_NOUN = ListUtil.toList(Phone.LIST_PHONE_NOUN);
        LIST_PHONE_VERB = ListUtil.toList(Phone.LIST_PHONE_VERB);
    }


    public static void main(String[] args) {
        /**
         * 提取时间 今天15点、明天14点12，大后天9点
         * 早上1点，上午2点，下午3点，今天4点
         * 本周,下周
         * 几月几日,几月几号,几月几,几年几月几日,几点
         */
        T001();
    }

    private static void T001() {
        Map<String, TimeEntity> timeEntityMap = new HashMap<>();
        timeEntityMap.putAll(TimeUtils.T001());
        timeEntityMap.putAll(TimeUtils.T002());
        timeEntityMap.putAll(TimeUtils.T003());
        timeEntityMap.putAll(TimeUtils.T004());
        timeEntityMap.putAll(TimeUtils.T005());
        timeEntityMap.putAll(TimeUtils.T006());
        timeEntityMap.putAll(TimeUtils.T007());
        timeEntityMap.putAll(TimeUtils.T008());
        timeEntityMap.putAll(TimeUtils.T009());
        timeEntityMap.putAll(TimeUtils.T0010());
        timeEntityMap.putAll(TimeUtils.T0011());
        buildParam( timeEntityMap, "T001\\");
    }


    private static void buildParam(Map<String, TimeEntity> timeEntityMap, String catalogue) {
        long startTime = System.currentTimeMillis();

        // Map<词槽名称，Map<词槽描述，词槽信息Entity>
        Map<String, Map<String, TimeEntity>> allSoltMap = new HashMap<>();

        Map<String, TimeEntity> nameMap = getNameWordSlot();
        allSoltMap.put("name", nameMap);

        Map<String, TimeEntity> phoneMap = getPhoneSlot();
        allSoltMap.put("phone", phoneMap);

        Map<String, TimeEntity> identityCardWordMap = getIdentityCardWordSlot();
        allSoltMap.put("identityCard", identityCardWordMap);

        allSoltMap.put("startTime", timeEntityMap);

        creatExcel(allSoltMap, catalogue);


        long endTime = System.currentTimeMillis();
        long executionTime = endTime - startTime;
        System.out.println("程序执行时间：" + executionTime + " 毫秒");

    }

    /**
     * 创建excel
     *
     * @param allSoltMap    Map<词槽名称，Map<词槽描述，词槽信息Entity>
     * @param catalogue     目录
     */
    private static void creatExcel(Map<String, Map<String, TimeEntity>> allSoltMap, String catalogue) {

        List<Map<String, TimeEntity>> allList = new ArrayList<>();
        Map<String, TimeEntity> phoneMap = allSoltMap.get("phone");
        Map<String, TimeEntity> identityCardMap = allSoltMap.get("identityCard");
        Map<String, TimeEntity> nameMap = allSoltMap.get("name");
        Map<String, TimeEntity> startTime = allSoltMap.get("startTime");
        allList.add(phoneMap);
        allList.add(identityCardMap);
        allList.add(nameMap);
        allList.add(startTime);



        List<QAEntity> allEntityList = new ArrayList<>();
        String code = "T00";
        // 一种
        {
            List<QAEntity> qaEntities = getQAEntityByKind("one", null, null, null, null, allSoltMap, "T001");
            allEntityList.addAll(qaEntities);
            ExcelUtil.createExcel(allEntityList, OUT_PATH + catalogue + code + 1 + ".xls");
        }


        {
            // 两种
            allEntityList = new ArrayList<>();
            List<List<Integer>> twoNumber = getSequenceNumber(2);
            for (List<Integer> integers : twoNumber) {
                Map<String, TimeEntity> one = allList.get(integers.get(0));
                Map<String, TimeEntity> two = allList.get(integers.get(1));
                List<QAEntity> qaEntities = getQAEntityByKind("two", one, two, null, null, allSoltMap, "T002");
                allEntityList.addAll(qaEntities);
            }
            allEntityList = random50List(allEntityList, 2000);
            ExcelUtil.createExcel(allEntityList, OUT_PATH + catalogue + code + 2 + ".xls");
        }


        // 三种
        {
            allEntityList = new ArrayList<>();
            List<List<Integer>> threeNumber = getSequenceNumber(3);
            for (List<Integer> integers : threeNumber) {
                Map<String, TimeEntity> one = allList.get(integers.get(0));
                Map<String, TimeEntity> two = allList.get(integers.get(1));
                Map<String, TimeEntity> three = allList.get(integers.get(2));
                List<QAEntity> qaEntities = getQAEntityByKind("three", one, two, three, null, allSoltMap, "T003");
                allEntityList.addAll(qaEntities);
            }
            allEntityList = random50List(allEntityList, 4000);
            ExcelUtil.createExcel(allEntityList, OUT_PATH + catalogue + code + 3 + ".xls");
        }


        // 四种
        {
            allEntityList = new ArrayList<>();
            List<List<Integer>> fourNumber = getSequenceNumber(4);
            for (List<Integer> integers : fourNumber) {
                Map<String, TimeEntity> one = allList.get(integers.get(0));
                Map<String, TimeEntity> two = allList.get(integers.get(1));
                Map<String, TimeEntity> three = allList.get(integers.get(2));
                Map<String, TimeEntity> four = allList.get(integers.get(3));
                List<QAEntity> qaEntities = getQAEntityByKind("four", one, two, three, four, allSoltMap, "T004");
                allEntityList.addAll(qaEntities);
            }
            allEntityList = random50List(allEntityList, 8000);
            ExcelUtil.createExcel(allEntityList, OUT_PATH + catalogue + code + 4 + ".xls");
        }
    }

    private static String getSoltKey(Map<String, TimeEntity> map ,Map<String, Map<String, TimeEntity>> allSoltMap){
        Map<String, TimeEntity> phoneMap = allSoltMap.get("phone");
        Map<String, TimeEntity> identityCardMap = allSoltMap.get("identityCard");
        Map<String, TimeEntity> nameMap = allSoltMap.get("name");
        Map<String, TimeEntity> timeMap = allSoltMap.get("startTime");
        if(map.equals(phoneMap)){
            return "phone";
        }
        if(map.equals(identityCardMap)){
            return "identityCard";
        }
        if(map.equals(nameMap)){
            return "name";
        }
        if(map.equals(timeMap)){
            return "startTime";
        }
        return null;
    }

    /**
     * 当没有集合四时，按照三三组合，当没有集合二时，按照二二组合，一次类推
     *
     * @param oneMap        集合一
     * @param twoMap        集合二
     * @param threeMap      集合三
     * @param fourMap       集合四
     * @param allSoltMap Map<词槽名称，Map<词槽描述，词槽信息Entity>
     * @param fileName   文件名称
     * @return
     */
    private static List<QAEntity> getQAEntityByKind(String type, Map<String, TimeEntity> oneMap,
                                                    Map<String, TimeEntity> twoMap,
                                                    Map<String, TimeEntity> threeMap,
                                                    Map<String, TimeEntity> fourMap,
                                                    Map<String, Map<String, TimeEntity>> allSoltMap,
                                                    String fileName) {

        List<Map<String, TimeEntity>> mapList = new ArrayList<>();
        mapList.addAll(allSoltMap.values());

        List<QAEntity> allEntitys = new ArrayList<>();

        int allCount = 1;

        if ("one".equals(type)){
            List<QAEntity> qaEntities = new ArrayList<>();
            for (String soltKey : allSoltMap.keySet()) {
                Map<String,TimeEntity> soltMap = allSoltMap.get(soltKey);
                for(TimeEntity timeEntity : soltMap.values()){
                    Map<String, Object> map = new HashMap<>();
                    map.put("sentence",timeEntity.getOther());
                    map.put("key0",soltKey);
                    map.put("value0", timeEntity.getTimeTemplate());
                    String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + fileName + "/question.ftl");
                    String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + fileName + "/answer.ftl");
                    qaEntities.add(new QAEntity("" + allCount, "", questionContent, answerContent));
                    allCount++;
                }
            }
            qaEntities = random50List(qaEntities,1000);
            allEntitys.addAll(qaEntities);
        }else if ("two".equals(type)) {
            List<QAEntity> qaEntities = new ArrayList<>();
            Set<String> oneSolts = oneMap.keySet();
            Set<String> twoSolts = twoMap.keySet();
            for (String oneSolt : oneSolts) {
                for (String twoSolt : twoSolts) {
                    Random random = new Random();
                    String punctuationOne = LIST_PUNCTUATION.get(random.nextInt(LIST_PUNCTUATION.size()));
                    String punctuationTwo= LIST_PUNCTUATION.get(random.nextInt(LIST_PUNCTUATION.size()));
                    Map<String, Object> map = new HashMap<>();
                    map.put("key0", getSoltKey(oneMap,allSoltMap));
                    map.put("key1", getSoltKey(twoMap,allSoltMap));
                    map.put("value0", oneMap.get(oneSolt).getTimeTemplate());
                    map.put("value1", twoMap.get(twoSolt).getTimeTemplate());

                    map.put("sentence", oneSolt + punctuationOne + twoSolt + punctuationTwo);
                    String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + fileName + "/question.ftl");
                    String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + fileName + "/answer.ftl");
                    qaEntities.add(new QAEntity("" + allCount, "", questionContent, answerContent));
                    allCount++;
                }
            }
            qaEntities = random50List(qaEntities,2000);
            allEntitys.addAll(qaEntities);
        }
        else if ("three".equals(type)) {
            List<QAEntity> qaEntities = new ArrayList<>();
            Set<String> oneSolts = oneMap.keySet();
            Set<String> twoSolts = twoMap.keySet();
            Set<String> threeSolts = threeMap.keySet();
            for (String oneSolt : oneSolts) {
                if(skip(3)){
                    continue;
                }
                for (String twoSolt : twoSolts) {
                    if(skip(3)){
                        continue;
                    }
                    for (String threeSolt : threeSolts) {
                        if(skip(3)){
                            continue;
                        }
                        Random random = new Random();
                        String punctuationOne = LIST_PUNCTUATION.get(random.nextInt(LIST_PUNCTUATION.size()));
                        String punctuationTwo = LIST_PUNCTUATION.get(random.nextInt(LIST_PUNCTUATION.size()));
                        String punctuationThree = LIST_PUNCTUATION.get(random.nextInt(LIST_PUNCTUATION.size()));
                        Map<String, Object> map = new HashMap<>();
                        map.put("key0", getSoltKey(oneMap,allSoltMap));
                        map.put("key1", getSoltKey(twoMap,allSoltMap));
                        map.put("key2", getSoltKey(threeMap,allSoltMap));
                        map.put("value0", oneMap.get(oneSolt).getTimeTemplate());
                        map.put("value1", twoMap.get(twoSolt).getTimeTemplate());
                        map.put("value2", threeMap.get(threeSolt).getTimeTemplate());

                        map.put("sentence", oneSolt + punctuationOne + twoSolt + punctuationTwo + threeSolt + punctuationThree);
                        String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + fileName + "/question.ftl");
                        String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + fileName + "/answer.ftl");
                        qaEntities.add(new QAEntity("" + allCount, "", questionContent, answerContent));
                        allCount++;
                    }
                }
            }
            qaEntities = random50List(qaEntities,3000);
            allEntitys.addAll(qaEntities);
        }else if ("four".equals(type)) {
            List<QAEntity> qaEntities = new ArrayList<>();
            Set<String> oneSolts = oneMap.keySet();
            Set<String> twoSolts = twoMap.keySet();
            Set<String> threeSolts = threeMap.keySet();
            Set<String> fourSolts = fourMap.keySet();
            for (String oneSolt : oneSolts) {
                if(skip(3)){
                    continue;
                }
                for (String twoSolt : twoSolts) {
                    if(skip(3)){
                        continue;
                    }
                    for (String threeSolt : threeSolts) {
                        if(skip(3)){
                            continue;
                        }
                        for (String fourSolt : fourSolts) {
                            if(skip(3)){
                                continue;
                            }
                            Random random = new Random();
                            String punctuationOne = LIST_PUNCTUATION.get(random.nextInt(LIST_PUNCTUATION.size()));
                            String punctuationTwo = LIST_PUNCTUATION.get(random.nextInt(LIST_PUNCTUATION.size()));
                            String punctuationThree = LIST_PUNCTUATION.get(random.nextInt(LIST_PUNCTUATION.size()));
                            String punctuationFour = LIST_PUNCTUATION.get(random.nextInt(LIST_PUNCTUATION.size()));
                            Map<String, Object> map = new HashMap<>();
                            map.put("key0", getSoltKey(oneMap, allSoltMap));
                            map.put("key1", getSoltKey(twoMap, allSoltMap));
                            map.put("key2", getSoltKey(threeMap, allSoltMap));
                            map.put("key3", getSoltKey(fourMap, allSoltMap));
                            map.put("value0", oneMap.get(oneSolt).getTimeTemplate());
                            map.put("value1", twoMap.get(twoSolt).getTimeTemplate());
                            map.put("value2", threeMap.get(threeSolt).getTimeTemplate());
                            map.put("value3", fourMap.get(fourSolt).getTimeTemplate());

                            map.put("sentence", oneSolt + punctuationOne + twoSolt + punctuationTwo + threeSolt + punctuationThree + fourSolt + punctuationFour);
                            String questionContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + fileName + "/question.ftl");
                            String answerContent = FtlUtil.generateContent(map, FREEMARKER_BASE_PATH + fileName + "/answer.ftl");
                            qaEntities.add(new QAEntity("" + allCount, "", questionContent, answerContent));
                            allCount++;
                        }
                    }
                }
            }
            qaEntities = random50List(qaEntities,4000);
            allEntitys.addAll(qaEntities);
        }


        return allEntitys;
    }

    /**
     * 获取首段描述（如：尊称）
     *
     * @return
     */
    public static String getHonorific() {
        List<String> greetings = Arrays.asList(
                "尊敬的领导",
                "尊敬的先生",
                "尊敬的女士",
                "尊敬的同事",
                "敬爱的领导",
                "尊贵的长者",
                "尊重的上级",
                "敬请关照",
                "王五告诉我",
                "李四和我说"
        );

        return getRandomElementAndPunctuation(greetings);
    }

    /**
     * 随机取值 + 标点
     *
     * @param list 随机集合
     * @return
     */
    private static String getRandomElementAndPunctuation(List<String> list) {
        Random random = new Random();
        int randomIndex = random.nextInt(list.size());
        int punctuationRandomIndex = random.nextInt(LIST_PUNCTUATION.size());
        String punctuationOne = LIST_PUNCTUATION.get(punctuationRandomIndex);
        return list.get(randomIndex) + punctuationOne;
    }

    /**
     * 随机取值
     *
     * @param list 随机集合
     * @return
     */
    private static String getRandomElement(List<String> list) {
        Random random = new Random();
        int randomIndex = random.nextInt(list.size());
        return list.get(randomIndex);
    }

    /**
     * 校验其他元素
     *
     * @param timeEntitys
     * @return
     */
    private static String judegOther(List<TimeEntity> timeEntitys) {
        if (CollectionUtil.isEmpty(timeEntitys)) {
            return "";
        }
        for (TimeEntity timeEntity : timeEntitys) {
            if (ObjectUtil.isNotEmpty(timeEntity) && !StringUtils.isEmpty(timeEntity.getOther())) {
                return timeEntity.getOther();
            }
        }
        return "";
    }

    /**
     * 校验时间元素
     *
     * @param timeEntitys
     * @return
     */
    private static TimeEntity judegTime(List<TimeEntity> timeEntitys) {
        if (CollectionUtil.isEmpty(timeEntitys)) {
            return null;
        }
        for (TimeEntity timeEntity : timeEntitys) {
            if (ObjectUtil.isNotEmpty(timeEntity) && !StringUtils.isEmpty(timeEntity.getTimeTemplate())) {
                return timeEntity;
            }
        }
        return null;
    }

    /**
     * 随机在集合中抽取元素
     *
     * @param allList
     * @return
     */
    public static List<QAEntity> random50List(List<QAEntity> allList) {
        if (allList.size() > 190) {
            List<QAEntity> newList = new ArrayList<>();
            for (int i = 0; i < 190; i++) {
                newList.add(allList.get(RandomUtil.randomInt(0, allList.size())));
            }
            return newList;
        } else {
            return allList;
        }
    }

    public static List<QAEntity> random50List(List<QAEntity> allList,Integer size) {
        if (allList.size() > size) {
            List<QAEntity> newList = new ArrayList<>();
            for (int i = 0; i < size; i++) {
                newList.add(allList.get(RandomUtil.randomInt(0, allList.size())));
            }
            return newList;
        } else {
            return allList;
        }
    }

    /**
     * 随机在集合中抽取元素
     *
     * @param allList
     * @return
     */
    public static List<String> random200List(List<String> allList,int size) {
        if (allList.size() > size) {
            List<String> newList = new ArrayList<>();
            for (int i = 0; i < size; i++) {
                newList.add(allList.get(RandomUtil.randomInt(0, allList.size())));
            }
            return newList;
        } else {
            return allList;
        }
    }


    public static List<List<Integer>> randomList(List<List<Integer>> allList,int size) {
        if (allList.size() > size) {
            List<List<Integer>> newList = new ArrayList<>();
            for (int i = 0; i < size; i++) {
                newList.add(allList.get(RandomUtil.randomInt(0, allList.size())));
            }
            return newList;
        } else {
            return allList;
        }
    }

    /**
     * 获取随机排列组合
     *
     * @param size 排列组合元素个数
     * @return
     */
    public static List<List<Integer>> getSequenceNumber(Integer size) {
        List<Integer> numbers = Arrays.asList(0, 1, 2, 3);
        List<List<Integer>> combinations = generateUnorderedDataUnorderedCombinations(numbers, size);
        combinations = combinations.stream().distinct().collect(Collectors.toList());

        List<List<Integer>> sortNumbers = new ArrayList<>();
        // 打印所有无序数据且无序组合
        for (List<Integer> combination : combinations) {
            Set<Integer> set = new HashSet<>(combination);
            if (set.size() == combination.size()) {
                sortNumbers.add(combination);
            }
        }
        return sortNumbers;
    }

    /**
     * 生成无序数据无序组合
     *
     * @param numbers
     * @param size
     * @return
     */
    public static List<List<Integer>> generateUnorderedDataUnorderedCombinations(List<Integer> numbers, int size) {
        List<List<Integer>> result = new ArrayList<>();
        generateUnorderedDataUnorderedCombinationsHelper(numbers, size, new ArrayList<>(), result);
        return result;
    }

    /**
     * 生成无序数据无序组合助手
     *
     * @param numbers
     * @param size
     * @param current
     * @param result
     */
    public static void generateUnorderedDataUnorderedCombinationsHelper(List<Integer> numbers, int size, List<Integer> current, List<List<Integer>> result) {
        if (size == 0) {
            // 在添加到结果前进行洗牌
            Collections.shuffle(current);
            result.add(new ArrayList<>(current));
            return;
        }

        for (int i = 0; i < numbers.size(); i++) {
            current.add(numbers.get(i));
            generateUnorderedDataUnorderedCombinationsHelper(numbers, size - 1, current, result);
            current.remove(current.size() - 1);
        }
    }


    /**
     * 名称词槽
     *
     * @return
     */
    private static Map<String, TimeEntity> getNameWordSlot() {
        Map<String, TimeEntity> nameMap = new HashMap<>();
        List<String> nameList = Arrays.asList(
                "王嘉柏", "李雅静", "张晨涛", "刘梦洁", "陈建华", "杨梓涵", "黄文斌", "赵雨薇", "吴宇航", "周紫宇",
                "徐宇轩", "孙梓轩", "马雨萌", "朱梓涵", "胡佳怡", "林子涵", "郭婧涵", "何奕菲", "高睿思", "罗雨婷"
        );
        for(String name : nameList) {
            String verbOne = getRandomElement(LIST_VERB_ONE);
            String key = name + verbOne + "机房";
            nameMap.put(key, TimeEntity.builder().other(key).timeTemplate(name).build());
        }
        return nameMap;
    }


    /**
     * 身份证信息词槽
     *
     * @return
     */
    private static Map<String, TimeEntity> getIdentityCardWordSlot() {
        Map<String, TimeEntity> identityCardWordSlotMap = new HashMap<>();
        List<String> identityCardWords = Arrays.asList(
                "110101199001015461", "120202198702285472", "13030319751212948X", "14040419880322149X", "15050519940430350X",
                "210606198206152512", "22070719700810352X", "23080819961124453X", "31090919890418554X", "321010197309036552",
                "41011119981110756X", "420212199202258572", "43031319810511958X", "44041419960627159X", "45051519840715260X",
                "530616197201203612", "54071719860328462X", "61081819970712563X", "62091919830827664X", "63102019760431765X"

        );
        for (String identityCardNum : identityCardWords ) {
            String phoneNoun = getRandomElement(LIST_IDENTITY_CARD_NOUN);
            String phoneVerv = getRandomElement(LIST_IDENTITY_CARD_NOUN);
            String key = phoneNoun + phoneVerv + identityCardNum;
            identityCardWordSlotMap.put(key, TimeEntity.builder().other(key).timeTemplate(identityCardNum).build());
        }
        return identityCardWordSlotMap;
    }

    /**
     * 手机号信息词槽
     *
     * @return
     */
    private static Map<String, TimeEntity> getPhoneSlot() {
        Map<String, TimeEntity> phoneMap = new HashMap<>();
        List<String> phonelist = Arrays.asList(
                "15112345678", "15123456789", "15134567890", "15145678901", "15156789012",
                "15167890123", "15178901234", "15189012345", "15190123456", "15101234567",
                "18212345678", "18223456789", "18234567890", "18245678901", "18256789012",
                "18267890123", "18278901234", "18289012345", "18290123456", "18201234567"
        );

        for (String phoneNum : phonelist) {
            String identityCardNoun = getRandomElement(LIST_PHONE_NOUN);
            String identityCardVerv = getRandomElement(LIST_IDENTITY_CARD_VERB);
            String key = identityCardNoun + identityCardVerv + phoneNum;
            phoneMap.put(key, TimeEntity.builder().other(key).timeTemplate(phoneNum).build());
        }
        return phoneMap;
    }

    private static boolean skip(Integer rate){
        int i = RandomUtil.randomInt(0, rate);
        if(i==0){
            return false;
        }
        return true;
    }
}
